<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <input type="text" id="strInput">
    <input type="button" value="小写变大写" id="button1">
    <input type="button" value="大写变小写" id="button2">

    <script>
    let button1 = document.getElementById('button1');
    button1.onclick = function(){
    let strInput = document.getElementById('strInput');
    let str = strInput.value;
    str = str.toUpperCase();
    strInput.value= str;
    }
        let button2 = document.getElementById('button2');
    button2.onclick = function(){
    let strInput = document.getElementById('strInput');
    let str = strInput.value;
    str = str.toLowerCase();
    strInput.value= str;}
    </script>
</body>
</html>